/*
 * Copyright (c) 2006, 2023, webrx.cn All rights reserved.
 *
 */
package cn.webrx;

import java.util.ArrayList;
import java.util.Collections;
import java.util.List;

/**
 * <p>Project: jse2302 - CollectionsDemo
 * <p>Powered by webrx On 2023-06-25 16:33:13
 * <p>Created by IntelliJ IDEA
 *
 * @author webrx [webrx@126.com]
 * @version 1.0
 * @since 17
 */
public class CollectionsDemo {
    public static void main(String[] args) {
        List<Integer> list = new ArrayList<>(List.of(1, 2, 3));
        //工具类的reverse()方法，进行
        Collections.reverse(list);
        list.set(0, 50);
        System.out.println(list);
        Collections.swap(list, 1, 2);
        System.out.println(list);
        Integer max = Collections.max(list);
        System.out.println(max);

        //检查1 在集合中出现的次数
        int f = Collections.frequency(List.of(1, 2, 2, 2, 1, 4, 1, 1), 1);
        System.out.println(f);

    }
}
